var restify = require('restify');
var client = restify.createJsonClient({
	url : 'http://localhost:8060'
});
var i;
exports.testPost = function(path, params) {
	client.post(path, params, function(err, req, res, data) {
		if (err) {
			console.log('testPost' + err);
		} else {
			console.log();
		}
	});
}

exports.testGet = function(path) {
	//'/foo/luoxuan'
	client.get(path, function(err, req, res, data) {
		console.log(data);
	})
}

exports.carMoves = function() {

}

exports.addDrivers = function(){	
	var tp = require('./autoTest');
	var i;
	var interVal = setInterval (function(){		
		var addInfo = {};
		addInfo.dri_id = "139123456" + i;
		addInfo.dri_credit = Math.floor(Math.random() * 5 + 1);
		
		addInfo.dri_lat = 31.195476 + Math.random()*0.01 - 0.005,
		addInfo.dri_lng = 121.54753 + Math.random()*0.01 - 0.005,
		
		addInfo.dri_pwd = '123',
		addInfo.taxi_number = 'SA'+ Math.floor(Math.random()*10),
		addInfo.liscense = '123123123',
		addInfo.car_color = 'red',
		addInfo.dri_nickname = 'luoxuan',
		addInfo.dri_photo = 'kkk',
		addInfo.dri_sex = 'male',
		addInfo.dri_phone = "139123456" + i;		
		tp.testPost('/addDriver' , addInfo);		
		},5000)
	}